<%@ page language="java" contentType="text/html; charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head>
    <title>成绩显示</title>
    <style type="text/css">
        table,thead,tbody,tfoot,th,td{border:1px dashed blue;}
    </style>
</head>
<body style="background:#8080C0">
  <div align="center" vertical-align="center">
<%
Connection con;
Statement sql; 
ResultSet rs;
ResultSet tt;
try{  Class.forName("com.mysql.jdbc.Driver");
}
catch(Exception e){
   out.println("");
}
try{ String uri= "jdbc:mysql://127.0.0.1/liuhuan";
String user="aa";
String password="";
con=DriverManager.getConnection(uri,user,password);
sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_READ_ONLY);
    String xh=request.getParameter("xh");
     rs=sql.executeQuery("SELECT * FROM  product where xh="+xh );
 		 ResultSetMetaData metaData = rs.getMetaData();
         int columnCount = metaData.getColumnCount(); //得到结果集的列数
		 rs.beforeFirst();
         int i=0;
           out.print("<table border=2>");
           out.print("<tr>");
           out.print("<th width=500>"+"xm");
           out.print("<th width=500>"+"xh");
           out.print("<th width=500>"+"sjk");
           out.print("<th width=500>"+"lj");
           out.print("<th width=500>"+"ls");
           out.print("<th width=500>"+"mg");
           out.print("<th width=500>"+"yy");
           out.print("</TR>");
         while(rs.next()){
             out.print("<tr>");
             out.print("<td >"+rs.getString(1)+"</td>"); 
             out.print("<td >"+rs.getString(2)+"</td>");
             out.print("<td >"+rs.getString(3)+"</td>"); 
             out.print("<td >"+rs.getString(4)+"</td>"); 
             out.print("<td >"+rs.getString(5)+"</td>"); 
             out.print("<td >"+rs.getString(6)+"</td>"); 
             out.print("<td >"+rs.getString(7)+"</td>");
             out.print("</tr>") ; 
         }
         out.print("</table>");
         con.close();
   }
   catch(SQLException e){ 
         out.print(e);
   }
%>
</body></HTML>